package com.demo.component;

import com.demo.model.User;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

/**
 * @Author YuanYuan
 * @Date 2023/2/10
 * @Time 11:02
 */

@Component
public class UserBean {
    @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
    @Bean
    public User user() {
        User user = new User();
        user.setName("哒哒");
        //System.out.println("Bean原名:" + user.getName());
        return user;
    }
}
